package designPattern.factory.simple;

public class SimpleFactory {
    public ICourse create(String str) {
        ICourse course = null;
        if("java".equals(str)) {
            course = new JavaCourse();
        } else if("python".equals(str)) {
            course = new PythonCourse();
        }
        return course;
    }
    public ICourse create(Class<? extends ICourse> clazz) {
        ICourse course = null;
        try {
            course = clazz.newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return course;
    }
}
